import "sort"

func findContentChildren(g []int, s []int) int {
	sort.Ints(g)
	sort.Ints(s)

	m, n := len(g), len(s)
	cnt := 0

	for i, j := 0, 0; i < m && j < n; i++ {
		for j < n && s[j] < g[i] {
			j++
		}
		if j < n {
			cnt++
			j++
		}
	}

	return cnt
}